import request from "@/utils/request";
//修改新手之影
export function updateGuide(data) {
  return request({
    url: "/system/user/updateGuide",

    method: "put",
    data: data,
  });
}
// 获取手机验证码
export function sendPhoneCode(params) {
  return request({
    url: "/system/user/sendPhoneCode",
    headers: {
      isToken: false,
    },
    method: "get",
    params: params,
  });
}
// 登录方法V2(如果开启了手机验证码登录就走这个接口登录)
export function loginV2(data) {
  return request({
    url: "/loginV2",
    headers: {
      isToken: false,
    },
    method: "post",
    data: data,
  });
}
// 手机验证码登录
export function phoneLogin(params) {
  return request({
    url: "/phoneLogin",
    headers: {
      isToken: false,
    },
    method: "get",
    params: params,
  });
}
// 获取手机验证码登录是否开启
export function getPhoneLoginEnabled() {
  return request({
    url: "/getPhoneLoginEnabled",
    headers: {
      isToken: false,
    },
    method: "get",
  });
}
// 获取手机验证码
export function sendPhoneCodeForUpdatePhone(params) {
  return request({
    url: "/system/user/sendPhoneCodeForUpdatePhone",
    method: "get",
    params: params,
  });
}
// 换绑手机号
export function changePhone(data) {
  return request({
    url: "/system/user/changePhone",
    method: "put",
    data: data,
  });
}
// 手机验证码重置密码
export function updatePwd(params) {
  return request({
    url: "/system/user/updatePwd",
    headers: {
      isToken: false,
    },
    method: "put",
    data: params,
  });
}

// 获取登录前缀
export function protocol_prefixApi() {
  return request({
    url: "/system/dict/data/type/protocol_prefix",
    headers: {
      isToken: false,
    },
    method: "get",
  });
}
// 登录方法
export function login(params) {
  return request({
    url: "/auth/loginPc",
    headers: {
      isToken: false,
      repeatSubmit: false,
    },
    method: "post",
    data: params,
  });
}

// 存role 和 branchid
// 存role 和 branchid
export function setRoleBranchId(roleld, branchId) {
  return request({
    url: `/system/role/cacheBranch/${roleld}`,
    method: "post",
    data: {
      branchId: branchId,
    },
  });
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: "/system/user/getInfo",
    method: "get",
  });
}

// 退出方法
export function logout() {
  return request({
    url: "/auth/logout",
    method: "delete",
  });
}

// 单点登录  code换token
export function tokenCallBack(params) {
  return request({
    url: "/auth/iDaaS/callback",
    params: params,
  });
}


// 获取自定义缓存数据
export function getUserGuideApi() {
  return request({
    url: "/system/user/profile/getUserGuide"
  });
}

// 自定义缓存数据
export function setUserGuideApi(params) {
  return request({
    url: "/system/user/profile/setUserGuide",
    params:params
  });
}

// 教师批改单点登录  code换token
export function getTokenByiDaaS(params) {
  return request({
    url: "/auth/iDaaS/getToken",
    params: params,
  });
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: "/code",
    headers: {
      isToken: false,
    },
    method: "get",
    timeout: 20000,
  });
}

// 管理员手机号验证
export function phoneCodeVerify(query) {
  return request({
    url: "/system/user/phoneCodeVerify",
    headers: {
      isToken: false,
    },
    method: "put",
    params:query,
    timeout: 20000,
  });
}
